# -*- coding: utf-8 -*-
import numpy as np
import pandas as pd

if __name__ == '__main__':
    series = pd.Series(np.random.rand(12), index=[['a', 'a', 'a', 'b', 'b', 'b', 'c', 'c', 'c', 'd', 'd', 'd'],
                                                  [1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, ]])
    print series
    print type(series.index)
    print series.index
    print "---------------------"
    print series['a']
    print series[:,1]
    print "-------交换分层顺序-------------"
    print series.swaplevel()
    print '--------------------------'
    print series.swaplevel().sortlevel()
    print series.max()